
//////////////////////////////////////////////////
/// "From Low-Cost Flights to the Ballot Box:  ///
///   How Eastern European Migration Shaped    ///
///        Far-Right Voting in London"         ///
///      By Elena Pupaza & Joachim Wehner      ///
///          The Journal of Politics           ///
//////////////////////////////////////////////////

* Replication do file
* Prepared with Stata/SE 17.0 for Mac
* November 12, 2022

* List of tables in chronological order (paper and online appendix):
* Table 1: Migration from new EU member states and far-right support in London-wide party list Assembly elections
* Table 2: Exploring channels with split sample regressions using initial unemployment, house prices, and contact with EU8+2
* Table D3: Descriptive statistics
* Table E2: First-stage regressions
* Table E3: Comparison between different instruments
* Table E4: Second-stage estimates with single vs multiple instruments
* Table G1: Number of votes cast for UKIP and BNP
* Table G2: Main regressions with 2008 elections
* Table G3: Building the main model
* Table G4: Turnout


*************
*** Paper ***
*************

*** Table 1: Migration from new EU member states and far-right support in London-wide party list Assembly elections

global X "prop_change_allother_Total p_change_unemployed p_change_retired p_change_inactive_student change_median_hh_income_thousand Median_hh_price_2001_thousand"

global Y "prop_change_New_Total p_change_unemployed p_change_retired p_change_inactive_student change_median_hh_income_thousand Median_hh_price_2001_thousand"

* OLS baseline
reg UKIP_member_ppc prop_change_New_Total $X i.borough, robust
reg BNP_member_ppc prop_change_New_Total $X i.borough, robust

* First stage
reg prop_change_New_Total distance_bus_km $X i.borough if UKIP_member_ppc!=., robust
test distance_bus_km

* Placebo first stage
reg prop_change_allother_Total distance_bus_km $Y i.borough if UKIP_member_ppc!=., robust
test distance_bus_km

* 2SLS (with distance from closest A6 or 757 bus stop as instrument)
xi: ivreg2 UKIP_member_ppc (prop_change_New_Total = distance_bus_km) $X i.borough,  robust
xi: ivreg2 BNP_member_ppc  (prop_change_New_Total = distance_bus_km) $X i.borough,  robust

* Reduced form
reg UKIP_member_ppc distance_bus_km $X i.borough, robust
reg BNP_member_ppc distance_bus_km $X i.borough, robust


*** Table 2: Exploring channels with split sample regressions using initial unemployment, house prices, and contact with EU8+2

* UKIP

* Main results (for reference)
ivregress 2sls UKIP_member_ppc (prop_change_New_Total = distance_bus_km) $X i.borough, robust

* Unemploment below/above median
ivregress 2sls UKIP_member_ppc (prop_change_New_Total = distance_bus_km) $X i.borough if above_median_unemployed_2001 == 0, robust
ivregress 2sls UKIP_member_ppc (prop_change_New_Total = distance_bus_km) $X i.borough if above_median_unemployed_2001 == 1, robust

* House prices below/above median
ivregress 2sls UKIP_member_ppc (prop_change_New_Total = distance_bus_km) $X i.borough if above_median_house_price_2001 == 0, robust
ivregress 2sls UKIP_member_ppc (prop_change_New_Total = distance_bus_km) $X i.borough if above_median_house_price_2001 == 1, robust

* Contact below/above median
ivregress 2sls UKIP_member_ppc (prop_change_New_Total = distance_bus_km) $X i.borough if above_median_absEU10_2001 == 0, robust
ivregress 2sls UKIP_member_ppc (prop_change_New_Total = distance_bus_km) $X i.borough if above_median_absEU10_2001 == 1, robust 

* BNP

* Main results (for reference)
ivregress 2sls BNP_member_ppc (prop_change_New_Total = distance_bus_km) $X i.borough, robust

* Unemploment below/above median
ivregress 2sls BNP_member_ppc (prop_change_New_Total = distance_bus_km) $X i.borough if above_median_unemployed_2001 == 0, robust
ivregress 2sls BNP_member_ppc (prop_change_New_Total = distance_bus_km) $X i.borough if above_median_unemployed_2001 == 1, robust

* House prices below/above median
ivregress 2sls BNP_member_ppc (prop_change_New_Total = distance_bus_km) $X i.borough if above_median_house_price_2001 == 0, robust
ivregress 2sls BNP_member_ppc (prop_change_New_Total = distance_bus_km) $X i.borough if above_median_house_price_2001 == 1, robust

* Contact below/above median
ivregress 2sls BNP_member_ppc (prop_change_New_Total = distance_bus_km) $X i.borough if above_median_absEU10_2001 == 0, robust
ivregress 2sls BNP_member_ppc (prop_change_New_Total = distance_bus_km) $X i.borough if above_median_absEU10_2001 == 1, robust 

* F-test on excluded instrument

* Main results (for reference)
reg prop_change_New_Total distance_bus_km $X i.borough if UKIP_member_ppc!=., robust
test distance_bus_km

* Unemploment below/above median
reg prop_change_New_Total distance_bus_km $X i.borough if above_median_unemployed_2001 == 0 & UKIP_member_ppc!=., robust
test distance_bus_km
reg prop_change_New_Total distance_bus_km $X i.borough if above_median_unemployed_2001 == 1 & UKIP_member_ppc!=., robust
test distance_bus_km

* House prices below/above median
reg prop_change_New_Total distance_bus_km $X i.borough if above_median_house_price_2001 == 0 & UKIP_member_ppc!=., robust
test distance_bus_km
reg prop_change_New_Total distance_bus_km $X i.borough if above_median_house_price_2001 == 1 & UKIP_member_ppc!=., robust
test distance_bus_km

* Contact below/above median
reg prop_change_New_Total distance_bus_km $X i.borough if above_median_absEU10_2001 == 0 & UKIP_member_ppc!=., robust
test distance_bus_km 
reg prop_change_New_Total distance_bus_km $X i.borough if above_median_absEU10_2001 == 1 & UKIP_member_ppc!=., robust
test distance_bus_km


****************
*** Appendix ***
****************

*** Table D3: Descriptive statistics

sum Member04BNP Member04BNP_percent Member12BNP Member12BNP_percent BNP_member_change BNP_member_ppc Member04UKIP Member04UKIP_percent Member12UKIP Member12UKIP_percent UKIP_member_change UKIP_member_ppc Turnout04 Turnout_mayoral_2012 Turnout_change Member04VotePresence Member12VotePresence TotalUKborn2001total TotalUKborn2011total UKborn_change prop_EU_New_2001_Total prop_EU_New_2011_Total prop_change_New_Total Census2001EU2_Total Census2011EU2_Total Census2001EU8_Total Census2011EU8_Total prop_allother_2001Total prop_allother_2011Total prop_change_allother_Total p_change_unemployed p_change_retired p_change_inactive_student Median_hh_income_2001_thousand Median_hh_income_2012_thousand change_median_hh_income_thousand  Median_hh_price_2001_thousand distance_bus_km distance_train_km share_EU10_2001_pc shift_share_EU10 share_EU10_1991_pc shift_share_EU10_1991 if UKIP_member_ppc!=.


*** Table E2: First-stage regressions

* Distance from closest A6/757 bus stop
reg prop_change_New_Total distance_bus_km $X i.borough if UKIP_member_ppc!=., robust
test distance_bus_km

* Distance from closest train station
* (King's Cross / St Pancrass for Luton; Tottenham Hale and Liverpool Street for Stansted)
reg prop_change_New_Total distance_train_km $X i.borough if UKIP_member_ppc!=., robust
test distance_train_km

* Shift-share instrument with 1991 initial shares
reg prop_change_New_Total shift_share_EU10_1991_thousand $X i.borough if UKIP_member_ppc!=., robust
test shift_share_EU10_1991_thousand

* 1991 initial shares
reg prop_change_New_Total share_EU10_1991_pc $X i.borough if UKIP_member_ppc!=., robust
test share_EU10_1991_pc

* Shift-share instrument with 2001 initial shares
reg prop_change_New_Total shift_share_EU10_thousand $X i.borough if UKIP_member_ppc!=., robust
test shift_share_EU10

* 2001 initial shares
reg prop_change_New_Total share_EU10_2001_pc $X i.borough if UKIP_member_ppc!=., robust
test share_EU10_2001_pc


*** Table E3: Comparison between different instruments

* UKIP

* OLS
reg UKIP_member_ppc prop_change_New_Total $X i.borough, robust

* Transport instruments
xi: ivreg2 UKIP_member_ppc (prop_change_New_Total = distance_bus_km) $X i.borough, robust
xi: ivreg2 UKIP_member_ppc (prop_change_New_Total = distance_train_km) $X i.borough, robust

* 1991 census instruments
xi: ivreg2 UKIP_member_ppc (prop_change_New_Total = shift_share_EU10_1991) $X i.borough, robust
xi: ivreg2 UKIP_member_ppc (prop_change_New_Total = share_EU10_1991_pc) $X i.borough,  robust

* 2001 census instruments
xi: ivreg2 UKIP_member_ppc (prop_change_New_Total = shift_share_EU10) $X i.borough, robust
xi: ivreg2 UKIP_member_ppc (prop_change_New_Total = share_EU10_2001_pc) $X i.borough,  robust

* BNP

* OLS
reg BNP_member_ppc prop_change_New_Total $X i.borough, robust

* Transport instruments
xi: ivreg2 BNP_member_ppc (prop_change_New_Total = distance_bus_km) $X i.borough, robust
xi: ivreg2 BNP_member_ppc (prop_change_New_Total = distance_train_km) $X i.borough, robust

* 1991 census instruments
xi: ivreg2 BNP_member_ppc (prop_change_New_Total = shift_share_EU10_1991) $X i.borough, robust
xi: ivreg2 BNP_member_ppc (prop_change_New_Total = share_EU10_1991_pc) $X i.borough,  robust

* 2001 census instruments
xi: ivreg2 BNP_member_ppc (prop_change_New_Total = shift_share_EU10) $X i.borough,  robust
xi: ivreg2 BNP_member_ppc (prop_change_New_Total = share_EU10_2001_pc) $X i.borough, robust


*** Table E4: Second-stage estimates with single vs multiple instruments

* Transport only (main results for reference)
xi: ivreg2 UKIP_member_ppc (prop_change_New_Total = distance_bus_km) $X i.borough,  robust first
xi: ivreg2 BNP_member_ppc  (prop_change_New_Total = distance_bus_km) $X i.borough,  robust first

* Transport & 91 shares
xi: ivreg2 UKIP_member_ppc (prop_change_New_Total = distance_bus_km share_EU10_1991_pc) $X i.borough,  robust first
xi: ivreg2 BNP_member_ppc  (prop_change_New_Total = distance_bus_km share_EU10_1991_pc) $X i.borough,  robust first

* Transport & 01 shares
xi: ivreg2 UKIP_member_ppc (prop_change_New_Total = distance_bus_km share_EU10_2001_pc) $X i.borough,  robust
xi: ivreg2 BNP_member_ppc  (prop_change_New_Total = distance_bus_km share_EU10_2001_pc) $X i.borough,  robust


*** Table G1: Number of votes cast for UKIP and BNP

* OLS
reg UKIP_member_change prop_change_New_Total $X i.borough, robust
reg BNP_member_change prop_change_New_Total $X i.borough, robust

* 2SLS
xi: ivreg2 UKIP_member_change (prop_change_New_Total = distance_bus_km) $X i.borough,  robust
xi: ivreg2 BNP_member_change (prop_change_New_Total = distance_bus_km) $X i.borough,  robust

* Reduced form
reg UKIP_member_change distance_bus_km $X i.borough, robust
reg BNP_member_change distance_bus_km $X i.borough, robust


*** Table G2: Main regressions with 2008 elections

global X "prop_change_allother_0108Total p_change_unemployed0108 p_change_retired0108 p_change_inactive_student0108 change_median_hh_income_th0108 Median_hh_price_2001_thousand"

global Y "prop_change_New_0108Total p_change_unemployed0108 p_change_retired0108 p_change_inactive_student0108 change_median_hh_income_th0108 Median_hh_price_2001_thousand"

* OLS
reg UKIP_member_0408ppc prop_change_New_0108Total $X i.borough, robust
reg BNP_member_0408ppc prop_change_New_0108Total $X i.borough, robust

* First stage
reg prop_change_New_0108Total distance_bus_km $X i.borough if UKIP_member_0408ppc!=., robust
test distance_bus_km

* Placebo first stage
reg prop_change_allother_0108Total distance_bus_km $Y i.borough if UKIP_member_0408ppc!=., robust
test distance_bus_km

* 2SLS
xi: ivreg2 UKIP_member_0408ppc (prop_change_New_0108Total = distance_bus_km) $X i.borough,  robust
xi: ivreg2 BNP_member_0408ppc  (prop_change_New_0108Total = distance_bus_km) $X i.borough,  robust

* Reduced form
reg UKIP_member_0408ppc distance_bus_km $X i.borough, robust
reg BNP_member_0408ppc distance_bus_km $X i.borough, robust


*** Table G3: Building the main model

* No controls
reg prop_change_New_Total distance_bus_km if UKIP_member_ppc!=., robust
test distance_bus_km
xi: ivreg2 UKIP_member_ppc (prop_change_New_Total = distance_bus_km),  robust
xi: ivreg2 BNP_member_ppc (prop_change_New_Total = distance_bus_km),  robust

* Baseline control (median house price in 2001)
reg prop_change_New_Total distance_bus_km Median_hh_price_2001_thousand if UKIP_member_ppc!=., robust
test distance_bus_km
xi: ivreg2 UKIP_member_ppc (prop_change_New_Total = distance_bus_km) Median_hh_price_2001_thousand,  robust
xi: ivreg2 BNP_member_ppc (prop_change_New_Total = distance_bus_km) Median_hh_price_2001_thousand,  robust

* Fixed effects (borough)
reg prop_change_New_Total distance_bus_km Median_hh_price_2001_thousand i.borough if UKIP_member_ppc!=., robust
test distance_bus_km
xi: ivreg2 UKIP_member_ppc (prop_change_New_Total = distance_bus_km) Median_hh_price_2001_thousand i.borough,  robust
xi: ivreg2 BNP_member_ppc (prop_change_New_Total = distance_bus_km) Median_hh_price_2001_thousand i.borough,  robust

* Demographic controls
reg prop_change_New_Total distance_bus_km Median_hh_price_2001_thousand prop_change_allother_Total p_change_retired p_change_inactive_student i.borough if UKIP_member_ppc!=., robust
test distance_bus_km
xi: ivreg2 UKIP_member_ppc (prop_change_New_Total = distance_bus_km) Median_hh_price_2001_thousand prop_change_allother_Total p_change_retired p_change_inactive_student i.borough,  robust
xi: ivreg2 BNP_member_ppc (prop_change_New_Total = distance_bus_km) Median_hh_price_2001_thousand prop_change_allother_Total p_change_retired p_change_inactive_student i.borough,  robust

* Economic controls
reg prop_change_New_Total distance_bus_km Median_hh_price_2001_thousand prop_change_allother_Total p_change_retired p_change_inactive_student p_change_unemployed change_median_hh_income_thousand i.borough if UKIP_member_ppc!=., robust
test distance_bus_km
xi: ivreg2 UKIP_member_ppc (prop_change_New_Total = distance_bus_km) Median_hh_price_2001_thousand prop_change_allother_Total p_change_retired p_change_inactive_student p_change_unemployed change_median_hh_income_thousand i.borough,  robust
xi: ivreg2 BNP_member_ppc (prop_change_New_Total = distance_bus_km) Median_hh_price_2001_thousand prop_change_allother_Total p_change_retired p_change_inactive_student p_change_unemployed change_median_hh_income_thousand i.borough,  robust

* EU8+2 initial share
reg prop_change_New_Total distance_bus_km Median_hh_price_2001_thousand prop_change_allother_Total p_change_retired p_change_inactive_student p_change_unemployed change_median_hh_income_thousand prop_EU_New_2001_Total i.borough if UKIP_member_ppc!=., robust
test distance_bus_km
xi: ivreg2 UKIP_member_ppc (prop_change_New_Total = distance_bus_km) Median_hh_price_2001_thousand prop_change_allother_Total p_change_retired p_change_inactive_student p_change_unemployed change_median_hh_income_thousand prop_EU_New_2001_Total i.borough,  robust
xi: ivreg2 BNP_member_ppc (prop_change_New_Total = distance_bus_km) Median_hh_price_2001_thousand prop_change_allother_Total p_change_retired p_change_inactive_student p_change_unemployed change_median_hh_income_thousand prop_EU_New_2001_Total i.borough,  robust


*** Table G4: Turnout

global X "prop_change_allother_Total p_change_unemployed p_change_retired p_change_inactive_student change_median_hh_income_thousand Median_hh_price_2001_thousand"

* OLS
reg Turnout_change prop_change_New_Total $X i.borough, robust

* First stage
reg prop_change_New_Total distance_bus_km $X i.borough if Turnout_change!=., robust
test distance_bus_km

* 2SLS
xi: ivreg2 Turnout_change (prop_change_New_Total = distance_bus_km) $X i.borough,  robust

* Reduced form
reg Turnout_change distance_bus_km $X i.borough, robust
